import { request } from './request'

// 获取所有学科
export const getSubjects = (userId,pageNum,pageSize) => {
  return request.get('/subjects/list',{userId,pageNum,pageSize})
}
/**
 * 返回示例 
 * {
 *  "code": 200,
 *  "message": "success",
 *  "data": {
    "total": 1,
    "list": [
      {
        "id": 1,
        "name": "subject_test",
        "description": "subject_test",
        "createdId": 1,
        "createdAt": "2025-02-06T14:39:21.000+00:00",
        "updatedAt": "2025-02-06T14:39:21.000+00:00",
        "status": 1
      }
    ],
    "pageNum": 1,
    "pageSize": 10,
    "size": 1,
    "startRow": 1,
    "endRow": 1,
    "pages": 1,
    "prePage": 0,
    "nextPage": 0,
    "isFirstPage": true,
    "isLastPage": true,
    "hasPreviousPage": false,
    "hasNextPage": false,
    "navigatePages": 8,
    "navigatepageNums": [
      1
    ],
    "navigateFirstPage": 1,
    "navigateLastPage": 1
  }
}
 */

// 创建学科
export const createSubject = (userId,name,description) => {
  return request.post('/subjects/create',{userId,name,description})
}
// 更新学科
export const updateSubject = (id,name,description) => {
  return request.post('/subjects/update',{id,name,description})
}
// 删除学科
export const deleteSubject = (id) => {
  return request.post('/subjects/delete',{id})
}

